home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / POINTER2.C < prev    next >
Text File  |  1989-12-30  |  768b  |  25 lines

  1. main()
  2. {
  3. char strg[40],*there,one,two;
  4. int *pt,list[100],index;
  5.  
  6.    strcpy(strg,"This is a character string.");
  7.  
  8.    one = strg[0];                 /* one and two are identical */
  9.    two = *strg;
  10.    printf("The first output is %c %c\n",one,two);
  11.  
  12.    one = strg[8];                /* one and two are indentical */
  13.    two = *(strg+8);
  14.    printf("the second output is %c %c\n",one,two);
  15.  
  16.    there = strg+10;        /* strg+10 is identical to strg[10] */
  17.    printf("The third output is %c\n",strg[10]);
  18.    printf("The fourth output is %c\n",*there);
  19.  
  20.    for (index = 0;index < 100;index++)
  21.       list[index] = index + 100;
  22.    pt = list + 27;
  23.    printf("The fifth output is %d\n",list[27]);
  24.    printf("The sixth output is %d\n",*pt);
  25. }